package top.tervest.easyshare.common.util;

import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ZhangNanNan
 * @create 2019-07-18 10:07
 */
public class HttpUtil {

    public static void writeJson(HttpServletResponse response,Object data){
        String msg = JSON.toJSONString(data);
        response.setContentType("application/json;charset=UTF-8");
        try {
            response.getWriter().write(msg);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
